package org.jcnc.IDEology.kernel.example;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.stage.Stage;
import org.jcnc.IDEology.kernel.Module;

public class JavaFXDemo extends Application implements org.jcnc.IDEology.kernel.Module {

    // Module name
    String ModuleName = "JavaFXDemo";

    // Primary stage for JavaFX application
    private Stage primaryStage;

    // Overriding start method from Application class
    @Override
    public void start(Stage primaryStage) {
        this.primaryStage = primaryStage;
        Label label = new Label("Hello, JavaFX!");
        Scene scene = new Scene(label, 500, 500);
        primaryStage.setScene(scene);
        primaryStage.show();
    }

    // Overriding initModule method from Module interface
    @Override
    public void initModule() {
        System.out.println(ModuleName + " is init!");
    }

    // Overriding startModule method from Module interface
    @Override
    public void startModule() {
        new Thread(JavaFXDemo::launch).start();
    }

    // Overriding stopModule method from Module interface
    @Override
    public void stopModule() {
        System.out.println(ModuleName + " is stop!");
    }

    // Overriding receiveMessage method from Module interface
    @Override
    public void receiveMessage(String message) {
        Module.super.receiveMessage(message);
    }
}
